<?php
ob_start();
session_start();
include "checksession.php";
include_once "../connect.php";

$grpId = $_GET["grpId"];

if (!empty($grpId)) {
    // ดึงข้อมูล  เงื่อนไขคือ cn_number = $cn_number
    $sql = "SELECT * FROM  graphic
                     JOIN typegrphic ON graphic.typeGrpId = typegrphic.typeGrpId
                     JOIN depart ON graphic.de_id = depart.id
            WHERE  graphic.grpId = '$grpId' 
                                            ";
    $rs = mysql_query($sql);

    if ($rs) {

        $objResult = mysql_fetch_array($rs);
        $altgrpReuiDate = $r['grpReuiDate'];
        $txtReuiDate = date('d-m-Y H:i', strtotime($altgrpReuiDate));
    } else {

        echo mysql_error();
    }
}
?>

<script language="javascript">
    function CheckValidate()
    {
        if (eval("document.frmMain.txtError.value") == "") {
            alert("กรุณากรอกช่อง รายละเอียด");
            eval("document.frmMain.txtError.focus();")
            return false;
        }
    }
</script>
<link type="text/css" href="../css/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script src="../js/jquery/jquery-1.4.3.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../js/jquery/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="../js/jquery/timepicker.js"></script>
<!--<script src="../js/jquery/ui/jquery-ui.js"></script>-->
<script type="text/javascript">
    $(function() {
        $('#txtDatefinis').datepicker({
            duration: '',
            showTime: true,
            constrainInput: false
        });
    });
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Adinop Co., Ltd. was founded as an ingredients importer and local manufacturers’ distributor in 1986. We also function as an exporter of finished products</title>
        <link rel="stylesheet" href="../css/style.css"/>
    </head>
    <body>
        <div align="center">
            <fieldset>
                <legend class="nameTitle">ลงทะเบียน ใบคำขอออกแบบงานกราฟิก</legend>
                <form  
                    method="Post"
                    action="requiGraphicUpSave.php"
                    enctype="multipart/form-data"
                    name ="frmMain" id="frmMain" OnSubmit="return CheckValidate();" />
                <table class="inputcontenttable"><br />

                    <tr align="top">
                        <td>รหัสพนักงาน</td>
                        <td><input  id="txtEmpid" name="txtEmpid" type="text" value="<?= $objResult['emp_id'] ?>" readonly/></td> 
                        <td width="50px"></td>
                        <td>ผู้แจ้ง</td>
                        <td><input id="txtNameEng" name="txtNameTha" type="text" value="<?= $objResult['grpnameTh'] ?> <?= $objResult['grpsurnameTh'] ?>"readonly/></td>      
                    </tr>
                    <tr valign="top" >

                        <td>แผนกฝ่าย</td>
                        <td><input id="txtDepartment"  name="txtDepartment" type="text" value="<?= $objResult['departname'] ?>" readonly/></td>  
                        <td width="50px"></td>
                        <td>วันที่ต้องการ</td>
                        <td><input id="requiteDatetime"  name="txtrequiteDatetime" type="text" value="<?= $txtReuiDate ?>" readonly/></td>
                    </tr>
                    <tr valign="top" >

                        <td>จำนวนที่ต้องการออกแบบให้</td>
                        <td><input id="txtCount"  name="txtCount" type="text" value="<?= $objResult['grpModel'] ?>" readonly/></td>  
                        <td width="50px"></td>
                        <td>วันที่คาดว่าจะออกแบบแล้วเสร็จ</td>
                        <td><input id="txtDatefinis"  name="txtDatefinis" type="text"/></td>  
                    </tr>
                    <tr valign="top" >
                        <td>Project Name :</td>
                        <td colspan="4"><input id="txtProject"  name="txtProject" type="text" value="<?= $objResult['grpNameProject'] ?>" readonly/></td>  
                    </tr>
                    <tr>
                        <td>รายละเอียด</td>
                        <td colspan="4"><textarea id="txtDetails" rows="4" cols="50" name="txtDetails" style="width: 445px" value="" readonly> <?= $objResult['grpDetail'] ?> </textarea></td> 
                    </tr>

                    <tr>
                        <td colspan="5" align="center"><input  type="submit" name="Submit" value="Save" style="height: 30px; width: 120px"/></td>
                    </tr>     
                    <input type="hidden" name="grpId" value="<?= $objResult['grpId'] ?>"/>
                    <input type="hidden" name="typeGrpId" value="<?= $objResult['typeGrpId'] ?>"/>
                    </form>
                </table>
            </fieldset>
        </div>
    </body>
</html>
